package com.kyivmohyla.kma2.client.events.refbook;

import com.google.gwt.event.shared.GwtEvent;

import java.util.ArrayList;
import java.util.List;

public class SelectNodesFromReferenceBookEvent<T> extends GwtEvent<SelectNodesFromReferenceBookEventHandler> {
    public static Type<SelectNodesFromReferenceBookEventHandler> TYPE = new Type<SelectNodesFromReferenceBookEventHandler>();
    private final List<T> selectedList;

    public SelectNodesFromReferenceBookEvent(List<T> selectedList) {
        this.selectedList = new ArrayList<T>();
        this.selectedList.addAll(selectedList);
    }

    public List<T> getType() {
        return selectedList;
    }

    public Type<SelectNodesFromReferenceBookEventHandler> getAssociatedType() {
        return TYPE;
    }

    protected void dispatch(SelectNodesFromReferenceBookEventHandler handler) {
        handler.onSelectNodesFromReferenceBook(this);
    }
}
